//
//  YBNormalSearchButton.m
//  GongXinDangJian
//
//  Created by apple on 17/11/30.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YBNormalSearchButton.h"

@implementation YBNormalSearchButton


- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title imageName:(NSString *)imageName imageSize:(CGFloat)imageSize
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor themeGrayColor];
        [self ybInitMyViewWithFrame:frame title:title imageName:imageName imageSize:imageSize];
    }
    return self;
}


-(void)ybInitMyViewWithFrame:(CGRect)frame title:(NSString *)title imageName:(NSString *)imageName imageSize:(CGFloat)imageSize{
    self.clipsToBounds = YES;
    self.layer.cornerRadius = frame.size.height / 2;
    CGFloat imageHeight = imageSize - ItemWidth * 9;
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width - frame.size.height / 2 - imageSize , (frame.size.height - imageHeight) / 2 , imageSize, imageHeight)];
    imageView.image = [UIImage imageNamed:imageName];
    [self addSubview:imageView];
    
    UILabel * titleLabel = [ToolClass creatLabelWithFrame:CGRectMake(frame.size.height / 2 + ItemWidth * 10, 0, frame.size.width - frame.size.height - imageSize - ItemWidth * 10, frame.size.height) font:15 textColor:[UIColor textGrayColor] text:title];
    [self addSubview:titleLabel];
}

@end
